function getDeviceType()
{
	  // Look for the formfactor as a url argument.
    var args = location.search;
    var start = args.indexOf("formfactor");
    if (start >= 0) {
      var value = args.substring(start);
      var begin = value.indexOf("=") + 1;
      var end = value.indexOf("&");
      if (end == -1) {
        end = value.length;
      }
      return value.substring(begin, end);
    }

    // Detect form factor from user agent.
    var ua = navigator.userAgent.toLowerCase();
    if (ua.indexOf("iphone") != -1 || ua.indexOf("ipod") != -1) {
      // iphone and ipod.
      return "mobile";
    } else if (ua.indexOf("ipad") != -1) {
      // ipad.
      return "tablet";
    } else if (ua.indexOf("android") != -1 || ua.indexOf("mobile") != -1) {
      /*
       * Android - determine the form factor of android devices based on the diagonal screen
       * size. Anything under six inches is a phone, anything over six inches is a tablet.
       */
      var dpi = 160;
      var width = window.screen.width / dpi;
      var height = window.screen.height / dpi;
      var size = Math.sqrt(width*width + height*height);
      return (size < 6) ? "mobile" : "tablet";
    }
    
    // Everything else is a desktop.
    return "desktop";
}

var device = getDeviceType();
var lien_css = document.createElement('link'); 
if(device == 'mobile' || device == 'tablet')
	lien_css.href = "Style/mobile.css"; 
else
	lien_css.href = "Style/style.css"; 
lien_css.rel = "stylesheet"; 
lien_css.type = "text/css"; 
document.getElementsByTagName("head")[0].appendChild(lien_css);